﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DA
{
   public class Quanlyhethong_DA
    {
         QLKhachSanDataContext ql;
       public object Login(NhanVien n )
       {
               ql = new QLKhachSanDataContext();
               return ql.NhanViens.Where(p => p.MaNV == n.MaNV && p.Password == n.Password).FirstOrDefault();
       }
       public bool DoiMK(NhanVien nv)
       {
           try
           {
               ql = new QLKhachSanDataContext();
               NhanVien update = ql.NhanViens.Where(p => p.MaNV == nv.MaNV).FirstOrDefault();
               update.Password = nv.Password;
               ql.SubmitChanges();
               return true;
           }
           catch
           {
               return false;
           }
           finally
           {
               ql.Dispose();
           }

       }
       public string  ktpass(string ma)
       {
           ql = new QLKhachSanDataContext();
           return ql.NhanViens.Where(p => p.MaNV == ma).Select(p => p.Password).FirstOrDefault();
       }
    }
}
